n = int(input())
m = int(input())
gongyue = 1
gongbei = 1
if m>=n:
    max = m
else:
    max = n


for i in range(1,max+1):
    if n%i==0 and m%i==0:
        gongyue = i

for j in range(1,m*n+1):
    if j%n==0 and j%m==0:
        gongbei = j
        break

print("最大公约数是：",gongyue)
print("最小公倍数是：",gongbei)
